# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-ssh2
_extname=ssh2
pkgver=1.4.1
pkgrel=0
pkgdesc="PHP 8.1 extension provide bindings for the libssh2 library - PECL"
url="https://pecl.php.net/package/ssh2"
arch="all"
license="PHP-3.01"
_phpv=81
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev libssh2-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
	# Check extension loading, testsuite skips tests if extension broken
	$_php -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
9ff90b95b8fabfa2a75cf8a62a55e93df19d3e952f79234fc1d7ef3a030089f8b3703412bf6e22d85c7bf5825cf8493a4d97ad51a1600185d3d16f81c72e155c  php-pecl-ssh2-1.4.1.tgz
"
